<template>
	<!--审核信息 -->
	<div>
		<FormPanel
			ref="FormPanel"
			:list="initForm"
			:cols="1"
			:formType="formType"
			:labelWidth="80"
			:isSubmitBtn="false"
			@formChange="formChangeHandle"
			class="mtop"
		/>
	</div>
</template>

<script>
	import { dictionary } from '@/utils/dictMixin';

	export default {
		mixins: [dictionary],
		model:{
			prop:'pdata',
			event:'click'
		},
		props: {
			pdata: {
				type: Object,
				default: () => ({})
			},
			formType:{
				type: String,
				required:true
			}
		},
		data() {
			return {
				initForm: this.initFormFun(),
			};
		},
		methods: {
			//初始化数据
			init() {
				this.initForm.forEach(x => {
					if(this.pdata[x.fieldName]){
						x.initialValue = this.pdata[x.fieldName];
					}
				});
			},
			formChangeHandle(val) {
				this.pdata = Object.assign(this.pdata,val);
				//传递数据到父组件里
				this.$emit('click', this.pdata);
				//触发外部的事件，以标志着本表单已经准备完毕
				this.$emit('formchange', this.pdata);
			},
			//开放的提交方法
			saveDialog(){
				this.$refs.FormPanel.SUBMIT_FORM();
			},
			//搜索数据
			initFormFun() {
				let bt = {required: true,message:'必填',trigger: ["change","blur"]};
				let btl = [bt];
				return [
					{
						type: 'TEXT_AREA',
						label: '审核意见',
						rows:4,
						maxlength:1000,
						fieldName: 'auditProposal',
						initialValue: '',
						rules:[],
						rulesTmp:btl,

					}
				];
			},
		}
	};
</script>